/*
 * type.h
 *
 *  Created on: 17 sept. 2013
 *      Author: the
 */

#ifndef TYPE_H_
#define TYPE_H_
#define MAX_N1 50
#define MAX_N2 100
#define MAX_FREQ 20
#define MAX_LINK 20000
#define MAXCONFLICT 9999999;

#define MAX(a, b) (a > b ? a : b)
#define MIN(a, b) (a < b ? a : b)

// The Anh : la frequence vide
#define VIDE -1
// Fin-The Anh

//Struct use to compute the routes (it is malloc and free in the function computing routes --> see metric.c for details).
struct tableEntry{
		int id;			//Destination id
		int done;		//Route found (or not)
		int minMetricPath;	//We are looking for path for which the min of the metrics is maximal
		int nbOfHops;
		int nextHop;
		int prevHop;
};

struct infoNeighbor{
	int id;			//node id
	int nbOfRadios;		//number of radios for this node
	int frequency;		//frequency used with this neighbor. -1 if there is no common frequency.
	int radio;		//radio used to reach this node.
	int metric;		//metric for this link (with this neighbor)
};

struct node{
	int id;		//id of the this node
	float x;	//coordinate of this node (abcsissa)
	float y;	//coordinate of this node (ordinate)
	int nbOfRadios;	//number of radios of this node
	int nbN1;	//Number of nodes in the neighborhood.
	struct infoNeighbor N1[MAX_N1];	//Information about the nodes in the neighborhood (N1).
	int nbN2;	//Number of nodes in N2/N1
	struct infoNeighbor N2[MAX_N2];	//Information about the nodes in the strict 2-neighborhood: N2/N1 (N2 without N1).
	int frequency[MAX_FREQ];	//Array describing the frequencies used by the radios of this node (in the radio order --> (radio0, freqx), (radio1, freqy), etc.
	struct routingEntry* routingTable;//Routing table is in the node index order.
	int routeFlag;	//Boolean that indicates that this node is already use on a route - we use it to compute disjoint routes.
};

struct routingEntry{
	int destination;	//id of the node for this entry
	int nextHop;		//id of the next_hop for this destination
	int cost;		//cost to reach this destination
	float cost2; // cost B(i)/IE(i)
	//int radio;		//radio used to reach this nextHop
	//int frequency;		//frequency assigned to this radio
};

struct link{
    int vertex1;
    int vertex2;
};



#endif /* TYPE_H_ */
